import os
import re

# html = """<img width='600' height='900' src='data:image/svg+xml,%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%220%200%20600%20900%22%3E%3C/svg%3E' data-src="https://tokyofashion.com/wp-content/uploads/2021/03/NK-2021-02-21-003-001-Harajuku-DZ7-4702-600x900.jpg" class="lazyload attachment-large size-large" alt="" data-srcset="https://tokyofashion.com/wp-content/uploads/2021/03/NK-2021-02-21-003-001-Harajuku-DZ7-4702-600x900.jpg 600w, https://tokyofashion.com/wp-content/uploads/2021/03/NK-2021-02-21-003-001-Harajuku-DZ7-4702-200x300.jpg 200w, https://tokyofashion.com/wp-content/uploads/2021/03/NK-2021-02-21-003-001-Harajuku-DZ7-4702-768x1152.jpg 768w, https://tokyofashion.com/wp-content/uploads/2021/03/NK-2021-02-21-003-001-Harajuku-DZ7-4702.jpg 1000w" data-sizes="(max-width: 600px) 100vw, 600px" itemprop="thumbnail" /></a></div>"""
#
# pattern = re.compile('768w,(.*?) 1000w',re.S)
# data = re.findall(pattern, html)
# for i in data:
#     print(i)
# os.mkdir('g:\\tokyo_fashion\\Japanese Gothic Street Style w/ Floral Hat, If Six Was Nine, Tata Christiane, Balmain & Book Bag')
# import requests
#
import requests

img = requests.get('https://tokyofashion.com/wp-content/uploads/2021/04/Harajuku-Fashion-Steampunk-20210327_DZ7_0935.jpg')
                   #https://tokyofashion.com/wp-content/uploads/2021/02/NK-2020-09-06-002-004-Harajuku-DZ7-7046-600x900.jpg
                   #https://tokyofashion.com/wp-content/uploads/2021/04/Harajuku-Fashion-Steampunk-20210327_DZ7_0935.jpg

file_name = 'djy' + '.jpg'

print('开始保存图片')

f = open(file_name, 'ab')

f.write(img.content)

print(file_name, '图片保存成功！')

f.close()



''''''